//
//  VCOfSecond.m
//  UI03_UIViewController_CustomView
//
//  Created by Scott on 16/3/11.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "VCOfSecond.h"
#import "MyButton.h"


@interface VCOfSecond ()

@end

@implementation VCOfSecond

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor redColor];
    
    [self createSubView];
    
}

#pragma mark - SubView
- (void)createSubView {
    
    MyButton *buttonOfBack = [MyButton buttonWithType:UIButtonTypeSystem];
    buttonOfBack.frame = CGRectMake(20, 300, self.view.frame.size.width - 40, 40);
    [self.view addSubview:buttonOfBack];
    
    buttonOfBack.backgroundColor = [UIColor yellowColor];
    [buttonOfBack setTitle:@"返回" forState:UIControlStateNormal];
    
    
    [buttonOfBack addTarget:self action:@selector(handleBack:) forControlEvents:UIControlEventTouchUpInside];
}

#pragma mark - 返回上一页
- (void)handleBack:(UIButton *)button {

    [self dismissViewControllerAnimated:YES completion:^{
                
    }];

}



#pragma mark -
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
